package com.qx.web_maven.dao;

import java.lang.reflect.Array;

public class UsersDao {
//返回所有的用户
    public  List<Users> getList() throws  Exception{
        try{

        }catch(Exception e){
            e.printStackTrace();
        }
        Class.forName("com.mysql.jdbc.Driver");
        Connection conn = DriverManager.getConnection(uil"jdbc:mysql://localhost:3306/test_maven"?userUnicode=teue&characterEncoding=utf8user"root",password" ");

        PreparedStatement pstmt =  conn.prepareStatement(sql:"select * from users");
        ResultSet rs = pstmt.executeQuery();
List<User> list = new ArrayList
        while (rs.next()){
            Users u = new Users();
            u.setId(rs,getInt(columLabel:"id"));
            u.setUername(rs.getString(columnLabel:"user.username"));
            u.setAge(rs.getString((columnl.abel"user.age");
            u.setBirth(rs.getlimestamp((columnl.abel"user.birth");
            list.add(u);

        }

        conn.close();
        return list;
    }
}
